import request from '@/utils/request.js';
const state = {
	cartList: []
}
const mutations = {
	SET_CARTLIST(state, cartList){
		state.cartList = cartList;
	}
}
const actions = {
	async getCartList({commit}){
		const result = await request('/getCartData');
		// console.log(result);
		commit('SET_CARTLIST', result)
	}
}
const getters = {
	goodsList(state){
		return (state.cartList || []).data || []
	}
}

export default {
	namespaced: true,
	state,
	mutations,
	actions,
	getters
}